package com.bs.sc.mgr.order.dao;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.bs.sc.mgr.order.entity.Order;
import com.bs.sc.mgr.order.entity.OrderItem;

@Repository("orderItemDao")
public interface OrderItemDao extends JpaRepository<OrderItem, String> {

	public List<OrderItem> findByOrder(Order order);

	@Query(value = "SELECT c.user_id,b.classify,a.grade FROM confirm_order_item a LEFT JOIN goods b ON a.goods_id = b.id LEFT JOIN confirm_order c ON a.order_id = c.id", nativeQuery = true)
	public List<Map<String, Object>> findUserClassifyGrade();
}
